import {Component, Injectable} from "@angular/core";

@Injectable(
  {
    providedIn: "root"
  }
)
export class Global {
  constructor() {
    Object.defineProperties(Array.prototype, {
      first: {
        get: function () {
          return this[0];
        }
      },
      last: {
        get: function () {
          return this[this.length - 1];
        }
      },
      removeEmpty: {
        get: function () {
          return this.filter((item: string | null | undefined) => item !== null && item !== undefined && item !== "");
        }
      }
    })
  }
}
